﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Castle.Windsor.Installer;
using TianYuan.Core.Dependency;
using TianYuan.Core.Domain.Uow.Interception;
using TianYuan.Data.Dapper.Dependency;

namespace TianYuan.Data.Dapper
{
    /// <summary>
    /// DapperData组件初始化
    /// </summary>
    public class DapperDataBootsrapper
    {
        public IIocManager IocManager { get; private set; }
        public DapperDataBootsrapper(IIocManager iocManager)
        {
            IocManager = iocManager;
        }
        public virtual void Initialize()
        {
            IocManager.IocContainer.Install(FromAssembly.This());//单独注册当前程序集
            UnitOfWorkInterceptorRegistrar.Initialize(IocManager);
            //GlobalConfiguration.Configuration.Services.Replace(typeof(IHttpControllerActivator),
            //new WindsorApiControllerActivator(IocManager.IocContainer));
            //IocManager.AddConventionalRegistrar(new DapperDataConventionalRegistrar());
            //UnitOfWorkRegistrar.Initialize(IocManager);
        }
        
    }
}
